package cn.buyclss.backend.controller.admin;

import cn.buyclss.backend.entity.support.RespResult;
import cn.buyclss.backend.entity.vo.shop.GoodsVO;
import cn.buyclss.backend.service.SysLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: Cecurio
 * @create: 2019-03-21 20:53
 **/
@RestController
@RequestMapping("/sys/log")
@Api(value = "系统日志", description = "系统日志")
public class SysLogController {

    @Autowired
    private SysLogService sysLogService;


    @GetMapping("/page")
    @RequiresRoles("admin")
    @ApiOperation(value = "查看系统日志", notes = "查看系统日志. 操作者角色：admin")
    @ApiImplicitParams({
        @ApiImplicitParam(paramType = "header", name = "Authorization", value = "用户凭证", required = true),
        @ApiImplicitParam(paramType = "query", name = "pageIndex", value = "分页：第几页，默认为1", required = true),
        @ApiImplicitParam(paramType = "query", name = "pageSize", value = "分页：每页多少条，默认为10", required = true)
    })
    public RespResult page(@RequestParam(value = "pageIndex", defaultValue = "1") Integer pageIndex,
                           @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
        return sysLogService.pageShow(pageIndex, pageSize);
    }


}
